﻿Imports Clo = Enhancements.Core.Logging
Imports Ere = Enhancements.Basic.RegularExpressions
Imports Exe = Enhancements.Basic.Expressions
Imports Gen = System.Collections.Generic
Imports Glo = System.Globalization
Imports Iou = System.IO
Imports Ope = Enhancements.Basic.Expressions.Operators
Imports Ref = System.Reflection
Imports Reg = System.Text.RegularExpressions
Imports Sys = System
Imports Tex = System.Text
Imports Val = Enhancements.Basic.Expressions.Values
Imports Xsd = System.Xml.Schema
Imports W3c = System.Xml

Namespace Enhancements.Basic.Expressions.Functions
    ''' <summary>Represents an operator that can be used by a function so that it can be expressed by an operator-like syntax.</summary>
    <Serializable(), DebuggerStepThrough()> _
    Public NotInheritable Class FunctionOperator

        ''' <summary>Initializes a FunctionOperator instance with the specified operator type and priority.</summary>
        ''' <param name="_operator">Operator type specification.</param>
        ''' <param name="_priority">Priority specification.</param>
        ''' <exception cref="FunctionOperatorOperatorIsValidNotException">_operator is not an allowed operator type.</exception>
        Public Sub New(ByVal _operator As Sys.Type, ByVal _priority As Sys.Int32)
            [Operator] = _operator
            Priority = _priority
        End Sub

        Private __Operator As Sys.Type = Nothing
        ''' <summary>Gets the operator type specified.</summary>
        Public Property [Operator]() As System.Type
            Get
                Return __Operator
            End Get
            Private Set(ByVal _value As System.Type)
                Try
                    _value.IsNullNot("Operator._value", True)
                    Ope.Operator.___OperatorsSortedGet().Values.ToArray().IsListContaining("Ope.Operator.___OperatorsSortedGet().Values.ToArray()", _value, "_value", True)
                Catch _exception As Sys.Exception
                    FunctionOperatorOperatorIsValidNotException.___Throw(_value, _exception)
                End Try

                __Operator = _value
            End Set
        End Property

        Private __Priority As Sys.Int32 = 0
        ''' <summary>Gets the priority this operator has in the evaluation of an expression.</summary>
        ''' <remarks>The highest the value the highest priority the operator has.</remarks>
        Public Property Priority() As Sys.Int32
            Get
                Return __Priority
            End Get
            Private Set(ByVal _value As System.Int32)
                __Priority = _value
            End Set
        End Property

    End Class
End Namespace
